home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / testmenu < prev    next >
Internet Message Format  |  1995-03-31  |  3KB

  1. From helens!shelby!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvia!scottb Fri Jun 29 00:49:48 PDT 1990
  2. Status: RO
  3.  
  4. Article 2020 of comp.sys.handhelds:
  5. Path: helens!shelby!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpcvia!scottb
  6. >From: scottb@hpcvia.CV.HP.COM (Scott_Burke)
  7. Newsgroups: comp.sys.handhelds
  8. Subject: Re: HP-48SX MENUS and WAIT
  9. Message-ID: <31210036@hpcvia.CV.HP.COM>
  10. Date: 28 Jun 90 22:19:55 GMT
  11. References: <2024@uc.msc.umn.edu>
  12. Organization: Hewlett-Packard Co., Corvallis, Oregon
  13. Lines: 50
  14.  
  15. Okay, here is a test-menu program that displays what I mentioned in a
  16. previous note.
  17.  
  18. It is a polite program, in that it preserves user flags and the last
  19. menu displayed before it was executed; these are standard techniques
  20. if you don't want to muck up the user's settings every time he/she
  21. uses your code.  You can take it a step further and preserve the stack,
  22. but since this code doesn't really do too much on the stack, I haven't
  23. worried about it.
  24.  
  25. The program displays a message and a menu, and then waits for one key-
  26. press.  It returns which key was pressed, in the form rc.p, where r is
  27. row, c is column, and p is plane (1 - not shifted, 2 - left-shifted, 
  28. etc.)  It traps the ATTN key, and returns 91.1 for that key.
  29.  
  30. The listing is just typed in, and is not downloadable.
  31.  
  32. <<
  33.   RCLF RCLMENU -> lastflags lastmenu    @ save flags and menu
  34.   <<
  35.     -55 SF                @ no LASTARGS; see note 1
  36.     { "A" "B" "C" "D" "E" "F" } TMENU    @ build temp menu list
  37.  
  38.     CLLCD                @ clear screen
  39.     "TEST-MENU PROGRAM" 3 DISP        @ display program msg.
  40.  
  41.     ERR0                @ clear ERRN,ERRM; note 2
  42.     IFERR
  43.       -1 WAIT                @ get keypress, show menu
  44.     THEN
  45.       IF ERRN # 0d ==            @ if it was an ATTN press,
  46.       THEN 91.1                @ return the key location
  47.       ELSE ERRN DOERR            @ else propagate the error
  48.       END
  49.     END
  50.  
  51.     lastmenu MENU lastflags STOF    @ restore flags and menu
  52.   >>
  53. >>
  54.  
  55. note 1:  -1 WAIT leaves -1 on the stack if LASTARGS (flag -55) is clear
  56.          default is clear, because LASTARGS can be useful; however, it
  57.          is a pain in this situation, because you would have to check 
  58.          if ERRN==0 and then DROP the -1.
  59.  
  60. note 2:  ERRN and ERRM contain the last error number and message, but
  61.          if the error/abort signal is an ATTN press, it does NOT change
  62.          ERRN and ERRM, but leaves them set to whatever the last error
  63.          was.  Therefore, if you clear them, you know you got an ATTN
  64.          if ERRN is #0d.
  65.  
  66.  
  67.